package com.longxi.tianjintianbao.ui.activity.visitor;

import android.content.Intent;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.visitor.SignVisitorAtPresenter;
import com.longxi.tianjintianbao.ui.view.visitor.ISignVisitorAtView;

import butterknife.BindView;

public class SignVisitorActivity extends BaseActivity<ISignVisitorAtView, SignVisitorAtPresenter> implements ISignVisitorAtView {
    @BindView(R.id.tvLeavedateTip)
    TextView mTvLeavedateTip;//来访人
    @BindView(R.id.llLeavedate)
    LinearLayout mLlLeavedate;//来访人
    @BindView(R.id.tvLeavedate)
    TextView mTvLeavedate;//来访人

    @BindView(R.id.tvHouse)
    TextView mTvHouse;//所属项目
    @BindView(R.id.etVisitorName)
    EditText mEtVisitorName;//来访人
    @BindView(R.id.etVisitorPhone)
    EditText mEtVisitorPhone;//联系电话
    @BindView(R.id.tvReceivedate)
    TextView mTvReceivedate;//预约来访时间
    @BindView(R.id.radioComevisitortype)
    RadioGroup mRadioComevisitortype;//受访人性质
    @BindView(R.id.etMaster)
    EditText mEtMaster;//受访人姓名
    @BindView(R.id.etMasterPhone)
    EditText mEtMasterPhone;//拜访对象电话
    @BindView(R.id.etHousedept)
    EditText mEtHousedept;//受访人房号部门
    @BindView(R.id.etCause)
    EditText mEtCause;//来访事由
    @BindView(R.id.etRemarks)
    EditText mEtRemarks;//请输入备注

    @BindView(R.id.btnLogin)
    Button mBtnLogin;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_sign_visitor;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mBtnLogin.setOnClickListener(v -> mPresenter.btnLogin());
//        mTvCertificateType.setOnClickListener(v -> mPresenter.getCertificatetype());
        mTvHouse.setOnClickListener(v -> mPresenter.selectArea());
        mTvReceivedate.setOnClickListener(v -> mPresenter.getCurrentDateTime(getTvReceivedate(), true));
//        mTvEntryDate.setOnClickListener(v -> mPresenter.getDate(getTvEntryDate()));
//        mTvTrialStartDate.setOnClickListener(v -> mPresenter.getDate(getTvTrialStartDate()));
//        mTvTrialEndDate.setOnClickListener(v -> mPresenter.getDate(getTvTrialEndDate()));
//        mTvChangeType.setOnClickListener(v -> mPresenter.showChangeType());
//        mTvAuditingName.setOnClickListener(v -> mPresenter.showAuditing());
//        mTvPersonnelName.setOnClickListener(v -> mPresenter.showPersonnel());
        mRadioComevisitortype.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId == R.id.rBtnZH){
                    mPresenter.comevisitortype = "住户";
                }else{
                    mPresenter.comevisitortype = "员工";
                }
            }
        });
    }

    @Override
    protected SignVisitorAtPresenter createPresenter() {
        return new SignVisitorAtPresenter(this);
    }

    @Override
    public TextView getTvLeavedateTip() {
        return mTvLeavedateTip;
    }

    @Override
    public LinearLayout getLlLeavedate() {
        return mLlLeavedate;
    }

    @Override
    public TextView getTvLeavedate() {
        return mTvLeavedate;
    }

    @Override
    public EditText getEtVisitorName() {
        return mEtVisitorName;
    }

    @Override
    public EditText getEtVisitorPhone() {
        return mEtVisitorPhone;
    }

    @Override
    public TextView getTvReceivedate() {
        return mTvReceivedate;
    }

    @Override
    public RadioGroup getRadioComevisitortype() {
        return mRadioComevisitortype;
    }

    @Override
    public EditText getEtCause() {
        return mEtCause;
    }

    @Override
    public TextView getTvHouse() {
        return mTvHouse;
    }

    @Override
    public EditText getEtMaster() {
        return mEtMaster;
    }

    @Override
    public EditText getEtMasterPhone() {
        return mEtMasterPhone;
    }

    @Override
    public EditText getEtHousedept() {
        return mEtHousedept;
    }

    @Override
    public EditText getEtRemarks() {
        return mEtRemarks;
    }


    @Override
    public Button getBtnLogin() {
        return mBtnLogin;
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        mPresenter.onActivityResult(requestCode, resultCode, data);
    }

}


